<template>

	<view class="container">
		<view v-if="isLogin">
			<image v-if="isLogin" @click="changeImage" class="headicon" src="../../static/113.png"></image>
			<view class="text-area" v-if="isLogin">
				<text class="title">{{userInfo.username}}</text>
			</view>
		</view>
		
		<view v-if="!isLogin">
			<image   v-if="!isLogin" class="headicon" src="../../static/my.png"></image>
			<view class="text-area">
				<button type="primary" size="mini" v-if="!isLogin" @click="newTopage">点击登录</button>
			</view>
		</view>
		
		
		<view style="width: 100%;">
			<view class="entries">
				<view class="entry">
					<text class="entry_text">个人信息</text>
					<image class="entry_arrow" src="/static/more.png" style="width: 50px; height: 50px;"></image>
				</view>
				<view class="entry"><text class="entry_text">订单列表</text>
					<image class="entry_arrow" src="/static/more.png" style="width: 50px; height: 50px;"></image>
				</view>
				<view class="entry"><text class="entry_text">修改密码</text>
					<image class="entry_arrow" src="/static/more.png" style="width: 50px; height: 50px;"></image>
				</view>
				<view class="entry"><text class="entry_text">意见反馈</text>
					<image class="entry_arrow" src="/static/more.png" style="width: 50px; height: 50px;"></image>
				</view>
			</view>
			<button type="primary" style="margin: 0 20px;" :disabled="!isLogin" @click="logout">退出</button <!--按钮-->
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				userInfo: {
				
				},
				isLogin: false
			}
		},
		onLoad() {},
		onShow() {
			this.getUserinfo()
			console.log(this.userInfo.data);
		},
		methods: {
			newTopage() {
				uni.navigateTo({
					url: '../second/index'
				})
			},
			logout() {
				uni.clearStorage()
				this.isLogin = false
			},
			getUserinfo() {
				this.userInfo = uni.getStorageSync("userInfo")
				let userObj = uni.getStorageSync("islogin")
				this.isLogin = userObj
			},
			changeImage(){
				
			}
		}
	}
</script>

<style>
	.container {
		display: flex;
		/*设置容器为弹性布局容器*/
		flex-direction: column;
		/*内部组件主轴从上到下排布*/
		align-items: center;
		/*内部组件交叉轴水平居中*/
		width: '100%';
		padding-top: 10%;
	}

	.entries {
		width: '90%';
		padding: 20px
	}

.headicon {
		height: 200rpx;
		width: 200rpx;
		margin-top: 80rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
		border-radius: 50%;
	}
	.text-area {
		display: flex;
		justify-content: center;
	}
	.entry {
		width: '90%';
		display: flex;
		flex-direction: row;
		align-items: center;
		height: 50px;
		justify-content: space-between;
		/*两端对齐*/
		border-top: 1px solid #CCC;
	}

	.entry:last-child {
		border-bottom: 1px solid #CCC;
	}
	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}

	.entry text {
		font-size: 20px;
	}
</style>